﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 违章类别对应安全观察沟通管理
/// </summary>
[Route("QHSEViolationCategoryObs/[action]")]
[ApiController]
public class QHSEViolationCategoryObsController : ControllerBase
{
    private readonly QHSEViolationCategoryObsService _violationCategoryObsService;

    public QHSEViolationCategoryObsController(QHSEViolationCategoryObsService violationCategoryObsService)
    {
        _violationCategoryObsService = violationCategoryObsService;
    }
    /// <summary>
    /// 违章类别对应安全观察沟通列表
    /// </summary>
    [CustomAuthorize("hdv_qhse_data")]
    [HttpGet]
    public async Task<AppResult> List()
    {
        List<QHSEViolationCategoryObsModel> menus = await _violationCategoryObsService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSEViolationCategoryObsModel> menus = await _violationCategoryObsService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 违章类别对应安全观察沟通
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> GetOResult([FromQuery] QHSEViolationCategoryObsPageInputModel inputModel)
    {
        var data = await _violationCategoryObsService.GetResult(inputModel);
        return AppResult.Status200OK(data: data);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> GetOResult1([FromQuery] QHSEViolationCategoryObsPageInputModel inputModel)
    {
        var data = await _violationCategoryObsService.GetResult(inputModel);
        return AppResult.Status200OK(data: data);
    }
}
